﻿using IniReadWrite;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace VisionRoc.Core
{
    public class SetGenCircle
    {
        public string Path;
        public SetGenCircle(string _Path)
        {
            if (!Directory.Exists(_Path))
            {
                Directory.CreateDirectory(_Path);
            }

            Path = _Path + "\\GenCircle.ini";
            if (File.Exists(Path))
            {
                ReadParameter();
            }
        }

        [Browsable(true), Description("圆：Row1参数"), Category("圆区域参数"), ReadOnly(false)]
        public double Row1 { get; set; }

        [Browsable(true), Description("圆：Col1参数"), Category("圆区域参数"), ReadOnly(false)]
        public double Col1 { get; set; }

        [Browsable(true), Description("圆：Radius参数"), Category("圆区域参数"), ReadOnly(false)]
        public double Radius { get; set; }


        /// <summary>
        /// 保存矩形1参数
        /// </summary>
        public void WriteParameter()
        {
            IniAPI.INIWriteValue(Path, "circle", "DrawRow", Row1.ToString());
            IniAPI.INIWriteValue(Path, "circle", "DrawCol", Col1.ToString());
            IniAPI.INIWriteValue(Path, "circle", "Radius", Radius.ToString());
            //IniAPI.INIWriteValue(Path, "圆", "DrawLength1", Col2.ToString());
        }



        /// <summary>
        /// 读取矩形1参数
        /// </summary>
        public void ReadParameter()
        {
            try
            {
                Row1 = Convert.ToDouble(IniAPI.INIGetStringValue(Path, "circle", "DrawRow", "0"));
                Col1 = Convert.ToDouble(IniAPI.INIGetStringValue(Path, "circle", "DrawCol", "0"));
                Radius = Convert.ToDouble(IniAPI.INIGetStringValue(Path, "circle", "Radius", "0"));
                //Col2 = Convert.ToDouble(IniAPI.INIGetStringValue(Path, "圆", "DrawLength1", "0"));
            }
            catch { }

        }

    }
}
